docs(cloud): add comprehensive INIT_CONFIG YAML configuration documentation for self-hosted deployments#879
Conversation
✅ Deploy Preview for bejewelled-pegasus-b0ce81 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
…ployment guide Co-authored-by: pontusringblom <170570911+pontusringblom@users.noreply.github.com>
Co-authored-by: pontusringblom <170570911+pontusringblom@users.noreply.github.com>
|
@aabidsofi19, should serverbaseURL come under this section? |
| @@ -1,5 +1,32 @@ | |||
| --- | |||
| title: Planning Layer5 Cloud Deployment | |||
| title: Planning | |||
|
|
||
| ## Provider Configuration Planning | ||
|
|
||
| When planning your self-hosted Layer5 Cloud deployment, consider how you will initialize and configure your provider instance. The `INIT_CONFIG` environment variable enables you to automate provider configuration during deployment. | ||
|
|
||
| ### Configuration Strategy | ||
|
|
||
| Before deploying, plan your configuration approach: | ||
|
|
||
| 1. **Provider Identity**: Define your provider name and identification | ||
| 2. **Initial Settings**: Determine which settings need to be configured at startup | ||
| 3. **Configuration Management**: Decide how configuration will be managed (environment variables, secrets, config files) | ||
| 4. **Update Strategy**: Plan for configuration updates and changes over time | ||
|
|
||
| ### Using INIT_CONFIG for Automated Setup | ||
|
|
||
| The `INIT_CONFIG` environment variable allows you to pre-configure your provider during deployment, eliminating manual setup steps. This is particularly valuable for: | ||
|
|
||
| - **Reproducible Deployments**: Ensure consistent configuration across environments | ||
| - **CI/CD Integration**: Automate deployments with predefined configurations | ||
| - **Infrastructure as Code**: Manage provider configuration alongside your infrastructure | ||
|
|
||
| For detailed usage and examples, see the [Deployment Guide](/cloud/self-hosted/deployment/#init_config). | ||
|
|
||
| {{< alert type="warning" title="Important" >}} | ||
| Plan your INIT_CONFIG carefully as it is only processed during initial startup. Changes require redeployment or manual configuration updates. | ||
| {{< /alert >}} Layer5 Cloud Deployment |
There was a problem hiding this comment.
This should not be included in the frontmatter, but should be in the body, @copilot.
There was a problem hiding this comment.
Fixed in commit 8f443c7. The Provider Configuration Planning section is now properly placed in the body after the frontmatter closes with ---.
Co-authored-by: pontusringblom <170570911+pontusringblom@users.noreply.github.com>
|
Too much info for users? @kishore08-07, what do you think? |
@yi-nuo426 I think this information is necessary for users. Self-hosted deployments require precise configuration, and comprehensive examples across bash/Docker/Kubernetes help users prevent setup failures and make informed decisions. |
|
T-30 minutes... |
| --- | ||
|
|
||
| ## High-level List of Deployment Tasks | ||
| ## High-level List of Deployment |
There was a problem hiding this comment.
| ## High-level List of Deployment | |
| ## High-level List of Deployment Tasks |
There was a problem hiding this comment.
Updated in commit b76bdfa. Changed the section heading to "High-level List of Deployment Tasks".
| For Docker deployments: | ||
|
|
||
| ```bash | ||
| docker run -e INIT_CONFIG='{"provider": {"name": "my-provider"}}' layer5/meshery-cloud |
There was a problem hiding this comment.
| docker run -e INIT_CONFIG='{"provider": {"name": "my-provider"}}' layer5/meshery-cloud | |
| # example | |
| docker run -e INIT_CONFIG='{"provider": {"name": "my-provider"}}' layer5/meshery-cloud |
There was a problem hiding this comment.
Added in commit b76bdfa. The Docker example now includes the "# example" comment.
Signed-off-by: Lee Calcote <leecalcote@gmail.com>
Co-authored-by: Kishore B <85435355+kishore08-07@users.noreply.github.com> Signed-off-by: pontus <170570911+pontusringblom@users.noreply.github.com>
| - **CI/CD Integration**: Automate deployments with predefined configurations | ||
| - **Infrastructure as Code**: Manage provider configuration alongside your infrastructure | ||
|
|
||
| For detailed usage and examples, see the [Deployment Guide](/cloud/self-hosted/deployment/#init_config). |
There was a problem hiding this comment.
@copilot, the other Deployment Guide referenced here is not publicly available for reference. Delete this reference and instead, incorporate the following information into a revision of your proposed "Provider Configuration Planning" page:
# Provider Admin Organization Initialization
This directory contains the configuration for initializing the Provider Admin organization and user during server boot-time.
## Overview
The Provider Admin organization is a special organization identified by the hardcoded UUID `11111111-1111-1111-1111-111111111111`. It represents the uber organization for all things Layer5 and serves as the root administrative organization for the cloud platform.
## Configuration
To enable Provider Admin organization initialization, set the `INIT_CONFIG` environment variable with the entire YAML configuration as its value. An example configuration is provided in `provider-init.yaml.example`.
### Environment Variable
```bash
INIT_CONFIG='organization:
name: "Layer5"
description: "The uber organization for all things Layer5."
country: "United States"
region: "North America"
user:
first_name: "Admin"
last_name: "User"
email: "admin@layer5.io"
username: "admin@layer5.io"
password: "change-me-on-first-login"'Configuration File Format
The configuration file is a YAML file with the following structure:
organization:
name: "Layer5"
description: "The uber organization for all things Layer5."
country: "United States"
region: "North America"
user:
first_name: "Admin"
last_name: "User"
email: "admin@layer5.io"
username: "admin@layer5.io" # Optional, defaults to email if not provided
password: "change-me-on-first-login" # RequiredRequired Fields
Organization:
name: Name of the provider organization (required)description: Description of the organization (optional)country: Country where the organization is located (optional)region: Region where the organization is located (optional)
User:
first_name: First name of the provider admin user (required)last_name: Last name of the provider admin user (required)email: Email address of the provider admin user (required)username: Username for the provider admin user (optional, defaults to email)password: Password for the provider admin user (required)
Behavior
Initialization Process
When the server starts and INIT_CONFIG is set:
- The YAML configuration is parsed and validated
- The system checks if the provider organization already exists (by UUID
11111111-1111-1111-1111-111111111111) - If the organization exists, initialization is skipped
- If the organization does not exist:
- Kratos identity is created with password credentials for authentication
- Provider admin user is created
- Admin and MeshMap roles are assigned to the user
- Provider organization is created with the hardcoded UUID
- User is added to the provider organization with organization admin role
Idempotency
The initialization process is idempotent:
- Running the server multiple times with the same configuration will not create duplicate organizations
- If the provider organization already exists, the initialization is skipped
- No errors are thrown if the organization already exists
Error Handling
If initialization fails:
- Errors are logged using MeshKit logger
- The server continues to start (non-fatal error)
- All database operations are wrapped in a transaction for atomicity
- If any step fails, all changes are rolled back
Testing
To test the initialization:
-
Create a YAML configuration based on
provider-init.yaml.example -
Set the
INIT_CONFIGenvironment variable with the entire YAML content:- Option A (Helm with inline values): Include
initConfigin the Helmvalues.yamlfile with the YAML configuration as a multiline string - Option B (Helm with --set-file flag): Use
--set-fileto load configuration from a separate file:helm install meshery-cloud ./install/kubernetes/helm/layer5-cloud \ --set-file env.initConfig=./config/provider-init.yaml.example
- Option C (Direct environment variable): Set the
INIT_CONFIGenvironment variable with the YAML content as a string
- Option A (Helm with inline values): Include
-
Start the server
-
Check logs for initialization messages:
INFO Initializing Provider Admin organization from config: organization:... INFO Provider user created with ID: user ID: <uuid> INFO Provider organization created with ID: 11111111-1111-1111-1111-111111111111 INFO Provider user added to organization with admin role -
Verify in the database:
SELECT * FROM organizations WHERE id = '11111111-1111-1111-1111-111111111111'; SELECT * FROM users WHERE email = 'admin@layer5.io';
Production Deployment
For production deployments:
- Create a secure YAML configuration with production values
- Store the configuration in a secure secrets management system (e.g., Kubernetes Secrets, HashiCorp Vault, AWS Secrets Manager)
- Set
INIT_CONFIGenvironment variable in your deployment configuration:- Helm (inline values): Use
initConfigvalue invalues.yamlwith the YAML configuration as a multiline string - Helm (--set-file): Use
--set-fileflag to load from a secure file:helm install meshery-cloud ./install/kubernetes/helm/layer5-cloud \ --set-file env.initConfig=/path/to/secure/provider-init.yaml
- Kubernetes: Create a Secret containing the YAML configuration and mount as environment variable
- Docker Compose: Use secrets or environment file with the YAML content
- Helm (inline values): Use
- Use strong, unique credentials for the provider admin user
- Consider rotating admin credentials regularly after initial setup
Skipping Initialization
To skip provider organization initialization:
- Do not set the
INIT_CONFIGenvironment variable, or - Set
INIT_CONFIGto an empty string
The server will log: INIT_CONFIG not set, skipping provider organization initialization
Troubleshooting
Invalid YAML Configuration
ERROR Failed to initialize Provider Admin organization: Failed to load provider initialization configuration
Solution: Verify that the INIT_CONFIG environment variable contains valid YAML syntax. Check for proper indentation and quotes.
Invalid Configuration
ERROR Failed to initialize Provider Admin organization: Provider initialization configuration is invalid
Solution: Check that all required fields are present in the YAML configuration:
organization.name(required)user.email(required)user.first_name(required)user.last_name(required)user.password(required)
Database Errors
ERROR Failed to create Provider Admin organization
ERROR Failed to create Provider Admin user
Solution: Check database connectivity and logs for detailed error messages. Ensure migrations have run successfully.
Security Considerations
- Store the
INIT_CONFIGvalue securely using secrets management systems - Never commit the
INIT_CONFIGvalue with real credentials to version control - Use strong, unique credentials for the provider admin user
- Rotate admin credentials regularly after initial setup
- Audit provider admin user activity
- Consider using environment-specific configurations for different deployment stages
There was a problem hiding this comment.
Updated in commit b76bdfa. I've removed the reference to the non-public Deployment Guide and incorporated the comprehensive YAML configuration documentation into the Provider Configuration Planning section, including:
- Provider Admin Organization Initialization details
- Complete YAML configuration format with organization and user fields
- Required and optional fields documentation
- Initialization process, idempotency, and error handling
- Deployment options (Helm inline, --set-file, direct env variable)
…AML config details Co-authored-by: pontusringblom <170570911+pontusringblom@users.noreply.github.com>
Documentation Update for INIT_CONFIG Environment Variable
/content/en/cloud/self-hosted/deployment/Changes Made
1. Deployment Guide (
/content/en/cloud/self-hosted/deployment/_index.md)Added comprehensive High-level List of Deployment Tasks section with INIT_CONFIG documentation:
-eflag (with example comment)2. Planning Guide (
/content/en/cloud/self-hosted/planning/_index.md)Comprehensive Provider Configuration Planning section with detailed YAML configuration:
11111111-1111-1111-1111-111111111111) and its role as the root administrative organizationvalues.yaml--set-fileflag for loading from separate filesDocumentation Principles Applied
References
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.